package sctu.edu.java.year2016.team04.yanghuilin.day20160603.chapter10_2;

import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

/**
 * Created by dell on 2016/6/3.
 * 分别向Set集合以及List集合中添加"A"、"a"、"c"、"C"、"a"5个元素，观察重复值“a”能否在List集合以及Set集合中成功添加。
 */
public class ListLetter {
    public static void main(String[] args) {
        //将5个元素分别赋值
        String a = "A", b = "a", c = "c", d = "C", e = "a";
        List<String> list = new LinkedList<String>();
        //将元素add到List集合中
        list.add(a);
        list.add(b);
        list.add(c);
        list.add(d);
        list.add(e);
        System.out.println("List集合为：" + list);
        //为Set集合赋值
        Set<String> set = new HashSet<String>();
        set.addAll(list);
        System.out.println("Set集合为：" + set);

    }
}
